package chapter04.Example3;
//定义Animal类
class Animal {
    void shout (){
        System.out.println("动物发出叫声");
    }
}
//定义Dog类继承Animal类
class Dog extends Animal {
    //重写父类Animal中的shout()方法
    void shout (){
        System.out.println("汪汪汪.....");
    }
}
//定义测试类
public class Example03 {
    public static void main (String [] args){
        Dog dog = new Dog();    //创建Dog类的实例对象
        dog.shout();            //调用Dog类重写的shout()方法
    }
}
